home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 1 Issue 2
/
PDCD-1 - Issue 02.iso
/
_utilities
/
utilities
/
001
/
_indicator
/
!Indicator
/
Source
(
.txt
)
< prev
next >
Wrap
RISC OS BBC BASIC V Source
|
1994-09-13
|
9KB
|
422 lines
><Indicator$Dir>.!RunImage
This application is FreeWare. (c) 1993 Dick Alstein
Appl$="Indicator"
Version$="1.04 (12-Sep-94)"
error
quit%=
.mask%=(1<<4)+(1<<5)+(1<<7)+(1<<11)+(1<<12)
"OS_ReadMonotonicTime"
mode%
-
"Wimp_Poll",mask%,blk%
reason%
)
"OS_ReadMonotonicTime"
(
t2%>t1%+1
used%+=t2%-t1%-1
1,2,3
=
"Wimp_PollIdle",mask%,blk%,t1%+period%
reason%
reason%
mode%
-
t2%>=updatetime%
newperiod
1,2,3
updateicon(
(
2 :
"Wimp_OpenWindow",,blk%
)
3 :
"Wimp_CloseWindow",,blk%
?
6 :
mouseclick(blk%!0,blk%!4,blk%!8,blk%!12,blk%!16)
'
8 :
"Wimp_ProcessKey",key%
9 :
menuselect(blk%)
!
17,18 :
receive(blk%)
quit%
"Wimp_CloseDown"
defaultstatus
setmode(0)
colour%(0)=11
colour%(1)=10
colour%(2)=7
colour%(3)=14
errbox(err$,boxes%)
errblk%!0=0
$(errblk%+4)=err$+
"Wimp_ReportError",errblk%,boxes%,Appl$
,click%
=(click%=1)
error
"Wimp_CloseDown" :
errbox(
$+" (line "+
)+")",3)
"Wimp_CloseDown"
flg%,page_size%,no_pages%
errblk% &100
"Wimp_Initialise",200,&4B534154,Appl$
osversion%,thistask%
error
iconblk% 32
blk% &300
indsize%=&100
indir% indsize%
indirend%=indir%+indsize%
ptrinfo% 20
I)spfilename$="<Indicator$Dir>.Sprites"
"OS_ReadModeVariable",27,0
;flg% :
test if hires modes available
(flg%
2)=0
spfilename$+="22"
"OS_File",17,spfilename$
,,,,spsize%
spsize%+=16
sparea% spsize%
sparea%!0=spsize%
sparea%!8=16
"OS_SpriteOp",256+9,sparea%
"OS_SpriteOp",256+10,sparea%,spfilename$
spname% 14
$spname%="display"
osversion%<300
iconblk%!0=-1
iconblk%!0=-7
iconblk%!4=0 : iconblk%!8=0
]$iconblk%!12=132 : iconblk%!16=68
iconblk%!20=&7000311A
iconblk%!24=spname%
iconblk%!28=sparea%
iconblk%!32=12
"Wimp_CreateIcon",,iconblk%
baricon%
"Wimp_OpenTemplate",,"<Indicator$Dir>.Templates"
d"infowin%=
loadtemplate("Info")
e!$(blk%!(92+3*32+20))=Version$
"Wimp_CloseTemplate"
initmenus
usage%(52)
mode%=-1
colour%(3)
peak%(4)
peaktime%(4)
"OS_ReadMonotonicTime"
"OS_ReadMemMapInfo"
page_size%,no_pages%
oMtotalmem%=(page_size%*no_pages%)
1024 :
for slider in freemem display
lastfree$=""
lasttime$=""
loadstatus
initmenus
"MenuUtil_Initialise",010,0
"MenuUtil_New",,Appl$,9
mainmenu%
"MenuUtil_Add",mainmenu%,"Info"
item_info%
"MenuUtil_Add",mainmenu%,"CPU usage"
item_mode0%
"MenuUtil_Add",mainmenu%,"Free memory"
item_mode1%
"MenuUtil_Add",mainmenu%,"Time"
item_mode2%
"MenuUtil_Add",mainmenu%,"VU meter"
item_mode3%
"MenuUtil_Add",mainmenu%,"Set colour"
item_colour%
"MenuUtil_Add",mainmenu%,"Save status"
item_savestat%
"MenuUtil_Add",mainmenu%,"Quit"
item_quit%
"MenuUtil_Dots",item_info%,1
"MenuUtil_Dots",item_mode3%,1
"MenuUtil_SubMenu",item_info%,infowin%
"MenuUtil_ColourMenu",,""
colourmenu%
"MenuUtil_SubMenu",item_colour%,colourmenu%
loadstatus
("<Indicator$Dir>.Status")
F%=0
defaultstatus
#F%,status%
I%=0
#F%,colour%(I%)
setmode(status%)
loadtemplate(name$)
handle%
"Wimp_CloseTemplate" :
error
"Wimp_LoadTemplate",,blk%+4,indir%,indirend%,-1,name$,0
,,indir%
"Wimp_CreateWindow",,blk%+4
handle%
=handle%
menuselect(selection%)
"Wimp_GetPointerInfo",,ptrinfo%
selection%!0
1,2,3,4
"
setmode(selection%!0 - 1)
selection%!4>=0
% colour%(mode%)=selection%!4
updateicon(
savestatus
quit%=
(ptrinfo%!8
showmenu(0)
modevar(v%)
val%
"OS_ReadModeVariable",-1,v%
,,val%
=val%
mouseclick(xpos%,ypos%,button%,wndw%,icon%)
wndw%
button%
showmenu(blk%)
mode%=3
setmode(0)
setmode(mode%+1)
mode%=0
setmode(3)
setmode(mode%-1)
newperiod
usagep%=(usagep%+1)
used%>period%
usage%(usagep%)=40
, usage%(usagep%)=(40*used%)
period%
used%-=period%
used%<(2*period%)
"OS_ReadMonotonicTime"
updatetime%
updatetime%+=period%
used%=0
updateicon(
*** plots text in the icon, H- and V-centered
ploticontext(text$,yoffset%)
xsize%
deskfont%=0
64-8*
(text$),46+yoffset%
text$;
"Wimp_TextOp",1,text$
xsize%
"Font_SetFont",deskfont%
"Font_SetFontColours",0,2,3,4
"Font_Paint",0,text$,1<<4,64-(xsize%
2),22+yoffset%
readvarval(var$)
len%
"OS_ReadVarVal",var$,blk%,256,0
,,len%
blk%?len%=13
=$(blk%)
receive(buf%)
sender%,ref%,code%,file%,cmd$
sender%=buf%!4
ref%=buf%!8
code%=buf%!16
sender% <> thistask%
code%
quit%=
#
desktop save (RiscOS 3)
file%=buf%!20
6 cmd$="Run "+
readvarval("Indicator$Dir")+
+
"OS_GBPB",2,file%,cmd$,
(cmd$)
&400CF
,
desktop font change (RiscOS 3.5)
updateicon(
savestatus
("<Indicator$Dir>.Status")
#F% :
error :
#F%,mode%
I%=0
#F%,colour%(I%)
seticon(window%,icon%)
iconblk%!0=window%
iconblk%!4=icon%
iconblk%!8=0
iconblk%!12=0
"Wimp_SetIconState",,iconblk%
setmode(newmode%)
mode%<>newmode%
mode%=newmode%
mode%
period%=40
I%=0
usage%(I%)=0
usagep%=0
used%=0
updatetime%=0
period%=50
period%=100
period%=1
peak%()=0
peaktime%()=0
updateicon(
showmenu(blkptr%)
"MenuUtil_TickOnly",mainmenu%,mode%+1
"MenuUtil_TickOnly",colourmenu%,colour%(mode%)
"MenuUtil_Show",mainmenu%,blkptr%
str(ptr%)
i%,s$
(ptr%?i%>=32)
(i%<255)
s$+=
(ptr%?i%)
i%+=1
updateicon(forceupdate%)
first, check if icon needs to be updated
mode%
D.
"Wimp_SlotSize",-1,-1
,,freepool%
free%=freepool%>>10
free%>=10000
G& free$=
(free%/1024),4)+" M"
H
free$=
(free%)+" k"
J
K" update%=(free$<>lastfree$)
time$=
$,17,5)
N" update%=(time$<>lasttime$)
update%=
update%
forceupdate%
osversion% < 350
deskfont%=0
VJ
"Wimp_ReadSysInfo",8
deskfont% :
get handle of desktop font
with desktop outline font, you can't choose the text colour, so
"MenuUtil_Fade",item_colour%,(mode%=2)
(deskfont%<>0)
"OS_SpriteOp",&13C,sparea%,"display",0
,R1,R2,R3
23,17,7,2,8;16;0,0 :
set char size to 8*16 units
mode%
^6
"OS_SpriteOp",&122,sparea%,"empty0",0,0,0
colour%(0)
J%=usagep%
I%=1
J%=(J%+1)
10+2*I%,12
usage%(J%)>=4
1,0,usage%(J%)
lastfree$=free$
j6
"OS_SpriteOp",&122,sparea%,"empty1",0,0,0
12,12
colour%(1)
m(
97,(100*free%)
(totalmem%),7
q!
ploticontext(free$,12)
lasttime$=time$
t6
"OS_SpriteOp",&122,sparea%,"empty2",0,0,0
colour%(2)
x
ploticontext(time$,0)
z6
"OS_SpriteOp",&122,sparea%,"empty3",0,0,0
I%=1
|$
"STM_ReadVU",I%
L%=(102*L%)>>8
~(
(t1%-peaktime%(I%)) > 50
peak%(I%)>10
peak%(I%)-=10
peak%(I%)=0
peaktime%(I%)=t1%
peak%(I%) < L%
peak%(I%)=L%
peaktime%(I%)=t1%
colour%(3)
#
12,12*(5-I%),L%,7
0,peak%(I%)-L%,0
1,0,-7
"OS_SpriteOp",&13C,R1,R2,R3
seticon(-1,baricon%)